package com.gator.spring.framework.webmvc.servlet;

import java.lang.reflect.Method;
import java.util.regex.Pattern;

/**
 * @Author PABLO
 * @Date 2022/5/8 13:34
 * @Desc handler映射器，建立request的请求路径URL和 某controller中某方法路径的映射
 */
public class PABLO_HandlerMapping {

    //方法对应实例对象  如/web
    private Object controller;
    //具体执行方法  如/add
    private Method method;
    //URL的正则匹配  /web/add
    private Pattern pattern;

    public PABLO_HandlerMapping(Pattern pattern, Object controller, Method method) {
        this.controller = controller;
        this.method = method;
        this.pattern = pattern;
    }

    @Override
    public String toString() {
        return "PABLO_HandlerMapping{" +
                "controller=" + controller +
                ", method=" + method +
                ", pattern=" + pattern +
                '}';
    }

    public Object getController() {
        return controller;
    }

    public void setController(Object controller) {
        this.controller = controller;
    }

    public Method getMethod() {
        return method;
    }

    public void setMethod(Method method) {
        this.method = method;
    }

    public Pattern getPattern() {
        return pattern;
    }

    public void setPattern(Pattern pattern) {
        this.pattern = pattern;
    }
}
